home *** CD-ROM | disk | FTP | other *** search
- Program: MAKEMRG.PRG Version 1.0 (Initial Release)
-
- Author: Michael A. Huber
- P.O. Box 501511
- Indianapolis, IN 46250-6511
-
- Notes: Creates a WordPerfect 5.1 merge file (MERGE.DAT) using
- up to 64 fields from a dBASE IV database. Also allows
- filtering of records, creating an index, convert the
- character fields to proper case and defining where
- the output merge file will be located.
-
- Requirements: WordPerfect 5.1 (Convert.Exe) - Trademark of WordPerfect Corp.
- dBASE IV - Trademark of Borland
-
- You may use this program and copy it freely among your friends or business
- associates. All I ask is that you do not remove this title screen from any
- copy you make and if you find the program useful send a donation of $10.00
- to me at the above address. A User Defined Function called PROPER() is
- located at the end of this program and is very useful even by itself.
-
-
-
- BACKGROUND:
- I was asked to correct a program recently which had been
- created specifically to maintain a database of distributors.
- When I looked at this program I recognized that it lacked the
- flexibility to allow the user to easily create their own
- custom merge file. I found that the user was not totally
- familiar with dBASE or WordPerfect and was using an instruction
- sheet that was obviously outdated and incorrect. I also found
- that many people were manually maintaining and manipulating
- information to be used in merge files and had limited experience
- in doing this, which meant that they struggled through the
- manuals for hours with limited success.
-
- This all spawned the idea that maybe I could create a program
- that would allow the user to easily create a merge file and for
- that user not to need a great deal of experience with database
- files and merge file formats.
-
- This program is simple to use and does not require the user to
- know anything about dBASE or WordPerfect other than how to start
- this program (which could easily be accomplished with a menu
- program) and how to create a merge document in Wordperfect. The
- program will become even more useful once the user understands
- which dBASE IV logical operator to use to restrict the number of
- records to be merged and what is the most logical index to
- use.
-
- INSTRUCTIONS:
- Start the program from within dBASE at either the dot prompt or
- for God only knows, through the dreaded ASSIST screen. The command
- would be:
-
- DO MAKEMRG
-
- At the "Database Filename Without Extension:" prompt, enter the name
- of any dBASE IV database. Do not enter the file extension since it
- is assumed to be .DBF. If the database is in another directory then
- make sure you include the path to that directory.
-
- FIELD LIST:
- Once you have entered the filename you will be presented with a screen
- which shows the first 64 fields in the database. Each field has a
- corresponding number which is used to create the field list. When you
- see the "Enter A Field Number:" prompt, enter the number of the field
- that you want to be in your merge file. Continue entering fields in
- this same way until you have completed the field list you want. When
- you are done press the ESC key to process the field list.
-
- WARNING: A field list cannot contain more than 256 characters which
- includes the necessary dBASE IV command language I have inserted. I
- didn't see any reason to increase the maximum string length since each
- field name has a maximum of 10 characters, which means that you will
- have roughly 25 fields to choose from for your field list.
-
- FILTER COMMAND:
- After you have processed your field list you are presented with the
- "Filter Command:" prompt. This allows you to set up a filter to
- restrict the records for output to the merge file. You must use
- legitimate dBASE IV syntax for the filter command. The following
- logical operators are acceptable:
-
- .and. .not. .or. < > <> =
-
- I have simulated a filter command as an example, so that novice dBASE
- users might better understand the syntax.
-
- If you are unsure what syntax to use then leave the filter command
- blank. When you are done press ENTER to process the filter.
-
- INDEX STATEMENT:
- After you have processed your filter you are presented with the
- "Index Statement:" prompt. This allows you to set up an index to
- organize the records output to the merge file. You must use
- legitimate dBASE IV syntax for the index command. An index with
- more than a single field must be of the same field type. In other
- words you cannot mix numeric and character fields without first
- converting the numeric field to a character string.
-
- I have simulated an index statement as an example, so that novice
- dBASE users might better understand the syntax.
-
- If you are unsure what syntax to use then leave the index statement
- blank. When you are done press ENTER to process the index.
-
- DIRECTORY PATH:
- After you have processed your index statement you are presented with
- the "Put MERGE.DAT In What Directory:" prompt. The default is whatever
- directory you started dBASE from, i.e. C:\DBASE\. If this is the
- proper directory then just press ENTER, otherwise enter the path to
- the directory you want. I prefer to place the file in my C:\WP51\
- directory. Once you are done press ENTER.
-
- If everything has been entered correctly then the program shows you at what
- step of the merging process it is. You will see several statements appear
- on the screen depending on the information you entered. The following may
- appear on your screen:
-
- PLEASE WAIT - Indexing Database Records
- PLEASE WAIT - Processing Database Records
- PLEASE WAIT - Converting [FIELDNAME] To Correct Case Using PROPER() U.D.F.
- PLEASE WAIT - Creating Merge File
-
- If everything was processed correctly and no errors were encountered then the
- the program displays the following message:
-
- *******************************************
- ********** MERGE FILE CREATED ***********
- *******************************************
- MAKEMRG.PRG by Michael A. Huber
- P.O. Box 501511, Indianapolis,IN 46250-6511
-
- If the program was unable to correctly process the merge file because of an
- error in the information that was entered then the following message is
- displayed along with a brief description of the error that occurred:
-
- *******************************************
- ********** MERGE FILE CREATION **********
- ********** FAILED **********
- *******************************************
- MAKEMRG.PRG by Michael A. Huber
- P.O. Box 501511, Indianapolis,IN 46250-6511
-
-
- ERROR NO. 35 Unterminated String
- USER DEFINED FUNCTION:
- Included at the end of the MAKEMRG program is a User Defined Function
- called PROPER(). This function was developed to convert any upper,
- lower or combined upper and lower case string to its' proper case. The
- problem is some strings have different sets of criteria i.e. "McQuick",
- "O'Grady", "R.R. #3 Box 59", etc. These case conventions have been
- taken into consideration with the PROPER() function. I have tested
- this function and have not found too many problems other than the
- following:
-
- 1) Because it is looking for the convention "Mc" within the string
- it looks at the current character position minus 2 to see if it
- should capitalize the next character. This is OK everywhere else
- but positions 1 and 2. Positions 1 and 2 will cause a dBASE #62
- error since the resulting position will either be a negative number
- or will equal 0. What dBASE does in this situation is to substitute
- position 1 as the starting position which is exactly what is
- necessary to check for the convention "Mc" anyway. I am sure that
- this problem could easily be resolved, but "hay, if it works why
- worry about it."
-
- 2) If used in a program like MAKEMRG it cannot tell if the string
- should be converted or not, simply based on the string itself. An
- example of this is a two character STATE field or a character field
- with all non-alphabetic characters (like SSN "999-99-9999") probably
- should not be converted. I have restricted MAKEMRG from converting
- a field which is named STATE. If your STATE field is named something
- different or your STATE field contains the full state name, you will
- probably want to modify MAKEMRG accordingly. As for the all non-
- alphabetic character strings, MAKEMRG goes ahead and processes the
- string since the result is the same as the original string anyway.
-
- 3) The last problem is not so much the function of PROPER() as it is
- the dreaded inconsistent data entry person. This function obviously
- is not intelligent enough to take everything into consideration,
- especially inconsistent data. An example of what I have seen is as
- follows:
-
- ORIGINAL RESULT
-
- R.R. #3 BOX 510 R.R. #3 Box 510 Ok
- RR #3 BOX 510 Rr #3 Box 510 Wrong
- 127 SOUTH 7TH STREET 127 South 7th Street Ok
- 127 SOUTH 7 TH STREET 127 South 7 Th Street Wrong
-
- STAND ALONE FUNCTION PROPER():
- To use this function from the dot prompt you must first remove it
- from MAKEMRG.PRG. To do this follow these steps:
-
- Start dBASE
- . (dBASE dot prompt)
- . MODI COMM MAKEMRG (dBASE editor)
- PgDn (To the bottom of the program)
- (Locate "FUNCTION Proper")
- (Move the cursor to the line above
- "FUNCTION Proper")
- F6 (Press F6 to begin block)
- (Move the cursor down to the line
- below "RETURN m_Str")
- ENTER (Press ENTER to end block)
- CTRL-KW (Hold the CTRL key down and press
- the "K" key and then the "W" key)
- PROPER.PRG (Enter the filename to be saved)
- ENTER (Press ENTER to save the file)
- ESC (Press ESC to un-block the text)
- ESC (Press ESC to exit the editor)
- YES (Answer YES to the Exit prompt)
-
- TO USE FUNCTION PROPER():
- After you have created the file called PROPER.PRG you are ready to
- use the function in many different ways. The following command must
- be used to identify the procedure file to search.
-
- . SET PROCEDURE TO PROPER
-
- Here are some sample uses and the correct syntax to use for this
- function:
-
- REPLACE ALL [fieldname] WITH PROPER([fieldname])
- @ [row],[col] SAY PROPER([feildname/memvar])
- ? PROPER([fieldname/memvar])
-